Since final
classes can’t be extended, indicating that functions in such a class are overrideable by adding the virtual
specifier is possibly misguided, and definitely confusing.
Noncompliant code example
class Base {
virtual void f1();
};
class C final : Base {
virtual void f1(); // Noncompliant
virtual void f2(); // Noncompliant
};
Compliant solution
class Base {
virtual void f1();
};
class C final : Base {
void f1() override;
void f2();
};